
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="java.util.*"
	import="model.Tweet"
	import="model.User"	
    %>
<html>
<head>
<title>Twweetoeuf</title>
<link rel="stylesheet" href="css/reset.css"> 
<link rel="stylesheet" href="css/screenDesign.css"> 
<link href='http://fonts.googleapis.com/css?family=Bangers' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Cantora+One' rel='stylesheet' type='text/css'>
<link rel="stylesheet" media="screen and (max-width: 1400px)" href="css/screenDesign1200.css" type="text/css" />
</head>
<body>
	<header>
		<a href="Tweets"><img src="img/cl01.png" alt="" /></a>
		<h1>Tweetoeuf</h1>
		<div id="Connexion">
			<img src="img/cl-users-avatar.png" alt="" />	
				<%

				out.print("<h2>"
						+"Connectez-vous"	
						+"</h2>"
						+"<form action='TweetsConnect' method='Post'>"
						+"<input type='email' name='email' placeholder='email' value='' size='30' />"
						+"<input type='password' name='pwd' placeholder='password' value='' size='30'/>"	
						+"<input type='hidden' name='where' value='"+request.getServletPath().substring(1) +"'/>"
						+"<input type='submit' name='submit'>"
						+"</form>"
						+"<hr/>"
						+"<p>Pas encore de compte? <button type='button'>Créer un compte</button> </p>"		
						);	
				%>		
		</div>		
	</header>
	<section>
		<div id="user">
			<img src="img/cl-users-avatar.png" alt="" />	
				<%
					String user = (String)request.getAttribute("userSelect");
					out.print("<h2>"
							+ user
							+"</h2>");		
				%>		
		</div>		
	<aside>
		<img src="img/cl-users.jpg" alt="" />
	<%
		TreeSet<User> ltUsers = (TreeSet<User>)request.getAttribute("users");
		out.print("<ul>");
		for(User t: ltUsers){
		out.print("<a href='tweetsfromuser?who="+t+"'><li>"
				+t.getFirstName() +" "+t.getLastName()
				+"</li></a>"
				);
			}
		out.print("</ul>");		
	%>	
	</aside>
	<%
		List<Tweet> ltweets = (List<Tweet>)request.getAttribute("tw");
		for(Tweet t: ltweets){
		out.print("<div>"
				+t.getText()
				+"<p>"+t.getUser()+" - "+t.getDatePublish()+"</p>"
				+"</div>"
				);
			}
	%>
	</section>
</body>
</html>